package com.usian.service;

import com.github.pagehelper.PageInfo;
import com.usian.common.dto.CompetitionDTO;
import com.usian.common.model.competition.CompetitionMember;
import com.usian.common.untils.Result;
import com.usian.common.vo.CompetitionVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @projectName: 2210A-project1
 * @package: com.usian.service
 * @className: CompetitionFeignService
 * @author: 莫洪维
 * @email: 1204315800@qq.com
 * @description: TODO
 * @date: 2023/8/23 18:29
 */
@FeignClient("day12Competition")
public interface CompetitionFeignService {

    /**
     * 根据竞赛ID查询试卷方法
     * @param competitionId
     * @return
     */
    @RequestMapping(value = "/competition/findPaper",method = RequestMethod.GET)
    public Result findPaper(@RequestParam("id") Long competitionId);

    /**
     * 参加竞赛方法(添加成员竞赛中间表数据)
     * @param competitionMember
     * @return
     */
    @RequestMapping(value = "/competitionMember/saveCompetitionMember",method = RequestMethod.POST)
    public Result saveCompetitionMember(CompetitionMember competitionMember);

    /**
     * 查询成员方法
     * @param comId
     * @return
     */
    @RequestMapping(value = "/competition/findComMem",method = RequestMethod.GET)
    public Result findComMem(@RequestParam("comId") Long comId);

    /**
     * 根据成员id查询竞赛数量
     *
     * @param memberId
     * @return
     */
    @RequestMapping(value = "/competitionMember/toCompetitionNum",method = RequestMethod.GET)
    public Result toCompetitionNum(@RequestParam("memberId") Long memberId);

    /**
     * 根据成员id查询竞赛id集合
     * @param memberId
     * @return
     */
    @RequestMapping(value = "/competitionMember/toMemberCompetition",method = RequestMethod.GET)
    public Result toMemberCompetition(@RequestParam("memberId") Long memberId);

    /**
     * 查询所有竞赛方法
     *
     * @param competitionDTO
     * @return
     */
    @RequestMapping(value = "/competition/list",method = RequestMethod.GET)
    public PageInfo<CompetitionVO> list(@SpringQueryMap CompetitionDTO competitionDTO);


    /**
     * 根据竞赛id查询成员数量
     *
     * @param competitionId
     * @return
     */
    @RequestMapping(value = "/competitionMember/competitionStudyNum",method = RequestMethod.GET)
    public Integer competitionStudyNum(@RequestParam("competitionId") Long competitionId);
}
